home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / gnome-doc-utils / gnome-doc-utils.make next >
Encoding:
Text File  |  2007-04-09  |  19.4 KB  |  564 lines

  1. # gnome-doc-utils.make - make magic for building documentation
  2. # Copyright (C) 2004-2005 Shaun McCance <shaunm@gnome.org>
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software Foundation,
  16. # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. #
  18. # As a special exception to the GNU General Public License, if you
  19. # distribute this file as part of a program that contains a
  20. # configuration script generated by Autoconf, you may include it under
  21. # the same distribution terms that you use for the rest of that program.
  22.  
  23. ################################################################################
  24. ## @@ Generating Header Files
  25.  
  26. ## @ DOC_H_FILE
  27. ## The name of the header file to generate
  28. DOC_H_FILE ?=
  29.  
  30. ## @ DOC_H_DOCS
  31. ## The input DocBook files for generating the header file
  32. DOC_H_DOCS ?=
  33.  
  34. $(DOC_H_FILE): $(DOC_H_DOCS);
  35.     @rm -f $@.tmp; touch $@.tmp;
  36.     echo 'const gchar* documentation_credits[] = {' >> $@.tmp
  37.     list='$(DOC_H_DOCS)'; for doc in $$list; do \
  38.       xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
  39.       if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
  40.       xsltproc --path "$$xmlpath" $(_credits) $$doc; \
  41.     done | sort | uniq \
  42.       | awk 'BEGIN{s=""}{n=split($$0,w,"<");if(s!=""&&s!=substr(w[1],1,length(w[1])-1)){print s};if(n>1){print $$0;s=""}else{s=$$0}};END{if(s!=""){print s}}' \
  43.       | sed -e 's/\\/\\\\/' -e 's/"/\\"/' -e 's/\(.*\)/\t"\1",/' >> $@.tmp
  44.     echo '    NULL' >> $@.tmp
  45.     echo '};' >> $@.tmp
  46.     echo >> $@.tmp
  47.     list='$(DOC_H_DOCS)'; for doc in $$list; do \
  48.       xmlpath="`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`:$(srcdir)/`echo $$doc | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`"; \
  49.       if ! test -f "$$doc"; then doc="$(srcdir)/$$doc"; fi; \
  50.       docid=`echo "$$doc" | sed -e 's/.*\/\([^/]*\)\.xml/\1/' \
  51.         | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`; \
  52.       echo $$xmlpath; \
  53.       ids=`xsltproc --xinclude --path "$$xmlpath" $(_ids) $$doc`; \
  54.       for id in $$ids; do \
  55.         echo '#define HELP_'`echo $$docid`'_'`echo $$id \
  56.           | sed -e 's/[^a-zA-Z_]/_/g' | tr 'a-z' 'A-Z'`' "'$$id'"' >> $@.tmp; \
  57.       done; \
  58.       echo >> $@.tmp; \
  59.     done;
  60.     cp $@.tmp $@ && rm -f $@.tmp
  61.  
  62. dist-check-gdu:
  63. if !HAVE_GNOME_DOC_UTILS
  64.     @echo "*** GNOME Doc Utils must be installed in order to make dist"
  65.     @false
  66. endif
  67.  
  68. .PHONY: dist-doc-header
  69. dist-doc-header: $(DOC_H_FILE)
  70.     @if test -f "$(DOC_H_FILE)"; then d=; else d="$(srcdir)/"; fi; \
  71.     echo "$(INSTALL_DATA) $${d}$(DOC_H_FILE) $(distdir)/$(DOC_H_FILE)"; \
  72.     $(INSTALL_DATA) "$${d}$(DOC_H_FILE)" "$(distdir)/$(DOC_H_FILE)";
  73.  
  74. doc-dist-hook: dist-check-gdu $(if $(DOC_H_FILE),dist-doc-header)
  75.  
  76. .PHONY: clean-doc-header
  77. _clean_doc_header = $(if $(DOC_H_FILE),clean-doc-header)
  78. clean-local: $(_clean_doc_header)
  79. distclean-local: $(_clean_doc_header)
  80. mostlyclean-local: $(_clean_doc_header)
  81. maintainer-clean-local: $(_clean_doc_header)
  82. clean-doc-header:
  83.     rm -f $(DOC_H_FILE)
  84.  
  85. all: $(DOC_H_FILE)
  86.  
  87.  
  88. ################################################################################
  89. ## @@ Generating Documentation Files
  90.  
  91. ## @ DOC_MODULE
  92. ## The name of the document being built
  93. DOC_MODULE ?=
  94.  
  95. ## @ DOC_ENTITIES
  96. ## Files included with a SYSTEM entity
  97. DOC_ENTITIES ?=
  98.  
  99. ## @ DOC_INCLUDES
  100. ## Files included with XInclude
  101. DOC_INCLUDES ?=
  102.  
  103. ## @ DOC_FIGURES
  104. ## Figures and other external data
  105. DOC_FIGURES ?=
  106.  
  107. ## @ DOC_FORMATS
  108. ## The default formats to be built and installed
  109. DOC_FORMATS ?= docbook
  110. _DOC_REAL_FORMATS = $(if $(DOC_USER_FORMATS),$(DOC_USER_FORMATS),$(DOC_FORMATS))
  111.  
  112. ## @ DOC_LINGUAS
  113. ## The languages this document is translated into
  114. DOC_LINGUAS ?=
  115. _DOC_REAL_LINGUAS = $(if $(filter environment,$(origin LINGUAS)),        \
  116.     $(filter $(LINGUAS),$(DOC_LINGUAS)),                    \
  117.     $(DOC_LINGUAS))
  118.  
  119. _DOC_ABS_SRCDIR = @abs_srcdir@
  120.  
  121.  
  122. ################################################################################
  123. ## Variables for Bootstrapping
  124.  
  125. _xml2po ?= `which xml2po`
  126.  
  127. _db2html ?= `$(PKG_CONFIG) --variable db2html gnome-doc-utils`
  128. _db2omf  ?= `$(PKG_CONFIG) --variable db2omf gnome-doc-utils`
  129. _chunks  ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/chunks.xsl
  130. _credits ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/credits.xsl
  131. _ids ?= `$(PKG_CONFIG) --variable xmldir gnome-doc-utils`/gnome/xslt/docbook/utils/ids.xsl
  132.  
  133. if ENABLE_SK
  134. _ENABLE_SK = true
  135. _skpkgdatadir ?= `scrollkeeper-config --pkgdatadir`
  136. _sklocalstatedir ?= `scrollkeeper-config --pkglocalstatedir`
  137. _skcontentslist ?= $(_skpkgdatadir)/Templates/C/scrollkeeper_cl.xml
  138. endif
  139.  
  140.  
  141. ################################################################################
  142. ## @@ Rules for OMF Files
  143.  
  144. db2omf_args =                                    \
  145.     --stringparam db2omf.basename $(DOC_MODULE)                \
  146.     --stringparam db2omf.format $(3)                    \
  147.     --stringparam db2omf.dtd                        \
  148.     $(shell xmllint --format $(2) | grep -h PUBLIC | head -n 1         \
  149.         | sed -e 's/.*PUBLIC \(\"[^\"]*\"\).*/\1/')            \
  150.     --stringparam db2omf.lang $(notdir $(patsubst %/$(notdir $(2)),%,$(2)))    \
  151.     --stringparam db2omf.omf_dir "$(OMF_DIR)"                \
  152.     --stringparam db2omf.help_dir "$(HELP_DIR)"                \
  153.     --stringparam db2omf.omf_in "$(_DOC_OMF_IN)"                \
  154.     $(if $(_ENABLE_SK),                            \
  155.       --stringparam db2omf.scrollkeeper_cl "$(_skcontentslist)")        \
  156.     $(_db2omf) $(2)
  157.  
  158. ## @ _DOC_OMF_IN
  159. ## The OMF input file
  160. _DOC_OMF_IN = $(if $(DOC_MODULE),$(wildcard $(_DOC_ABS_SRCDIR)/$(DOC_MODULE).omf.in))
  161.  
  162. ## @ _DOC_OMF_DB
  163. ## The OMF files for DocBook output
  164. _DOC_OMF_DB = $(if $(_DOC_OMF_IN),                        \
  165.     $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-$(lc).omf))
  166.  
  167. $(_DOC_OMF_DB) : $(_DOC_OMF_IN)
  168. $(_DOC_OMF_DB) : $(DOC_MODULE)-%.omf : %/$(DOC_MODULE).xml
  169.     @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {    \
  170.       echo "The file '$(_skcontentslist)' does not exist." >&2;        \
  171.       echo "Please check your ScrollKeeper installation." >&2;        \
  172.       exit 1; }
  173.     xsltproc -o $@ $(call db2omf_args,$@,$<,'docbook') || { rm -f "$@"; exit 1; }
  174.  
  175. ## @ _DOC_OMF_HTML
  176. ## The OMF files for HTML output
  177. _DOC_OMF_HTML = $(if $(_DOC_OMF_IN),                        \
  178.     $(foreach lc,C $(_DOC_REAL_LINGUAS),$(DOC_MODULE)-html-$(lc).omf))
  179.  
  180. $(_DOC_OMF_HTML) : $(_DOC_OMF_IN)
  181. $(_DOC_OMF_HTML) : $(DOC_MODULE)-html-%.omf : %/$(DOC_MODULE).xml
  182. if ENABLE_SK
  183.     @test "x$(_ENABLE_SK)" != "xtrue" -o -f "$(_skcontentslist)" || {    \
  184.       echo "The file '$(_skcontentslist)' does not exist" >&2;        \
  185.       echo "Please check your ScrollKeeper installation." >&2;        \
  186.       exit 1; }
  187. endif
  188.     xsltproc -o $@ $(call db2omf_args,$@,$<,'xhtml') || { rm -f "$@"; exit 1; }
  189.  
  190. ## @ _DOC_OMF_ALL
  191. ## All OMF output files to be built
  192. # FIXME
  193. _DOC_OMF_ALL =                                    \
  194.     $(if $(filter docbook,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_DB))        \
  195.     $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_OMF_HTML))
  196.  
  197. .PHONY: omf
  198. omf: $(_DOC_OMF_ALL)
  199.  
  200.  
  201. ################################################################################
  202. ## @@ C Locale Documents
  203.  
  204. ## @ _DOC_C_MODULE
  205. ## The top-level documentation file in the C locale
  206. _DOC_C_MODULE = $(if $(DOC_MODULE),C/$(DOC_MODULE).xml)
  207.  
  208. ## @ _DOC_C_ENTITIES
  209. ## Files included with a SYSTEM entity in the C locale
  210. _DOC_C_ENTITIES = $(foreach ent,$(DOC_ENTITIES),C/$(ent))
  211.  
  212. ## @ _DOC_C_XINCLUDES
  213. ## Files included with XInclude in the C locale
  214. _DOC_C_INCLUDES = $(foreach inc,$(DOC_INCLUDES),C/$(inc))
  215.  
  216. ## @ _DOC_C_DOCS
  217. ## All documentation files in the C locale
  218. _DOC_C_DOCS =                                \
  219.     $(_DOC_C_ENTITIES)    $(_DOC_C_INCLUDES)            \
  220.     $(_DOC_C_MODULE)
  221.  
  222. ## @ _DOC_C_DOCS_NOENT
  223. ## All documentation files in the C locale,
  224. ## except files included with a SYSTEM entity
  225. _DOC_C_DOCS_NOENT =                            \
  226.     $(_DOC_C_MODULE)    $(_DOC_C_INCLUDES)
  227.  
  228. ## @ _DOC_C_FIGURES
  229. ## All figures and other external data in the C locale
  230. _DOC_C_FIGURES = $(if $(DOC_FIGURES),                    \
  231.     $(foreach fig,$(DOC_FIGURES),C/$(fig)),                \
  232.     $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/C/figures/*.png)))
  233.  
  234. ## @ _DOC_C_HTML
  235. ## All HTML documentation in the C locale
  236. # FIXME: probably have to shell escape to determine the file names
  237. _DOC_C_HTML = $(foreach f,                        \
  238.     $(shell xsltproc --xinclude                     \
  239.       --stringparam db.chunk.basename "$(DOC_MODULE)"        \
  240.       $(_chunks) "C/$(DOC_MODULE).xml"),                \
  241.     C/$(f).xhtml)
  242.  
  243. ###############################################################################
  244. ## @@ Other Locale Documentation
  245.  
  246. ## @ _DOC_POFILES
  247. ## The .po files used for translating the document
  248. _DOC_POFILES = $(if $(DOC_MODULE),                        \
  249.     $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(lc).po))
  250.  
  251. .PHONY: po
  252. po: $(_DOC_POFILES)
  253.  
  254. ## @ _DOC_LC_MODULES
  255. ## The top-level documentation files in all other locales
  256. _DOC_LC_MODULES = $(if $(DOC_MODULE),                        \
  257.     $(foreach lc,$(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xml))
  258.  
  259. ## @ _DOC_LC_XINCLUDES
  260. ## Files included with XInclude in all other locales
  261. _DOC_LC_INCLUDES =                                \
  262.     $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach inc,$(_DOC_C_INCLUDES),    \
  263.         $(lc)/$(notdir $(inc)) ))
  264.  
  265. ## @ _DOC_LC_HTML
  266. ## All HTML documentation in all other locales
  267. # FIXME: probably have to shell escape to determine the file names
  268. _DOC_LC_HTML =                                    \
  269.     $(foreach lc,$(_DOC_REAL_LINGUAS),$(foreach doc,$(_DOC_C_HTML),        \
  270.         $(lc)/$(notdir $(doc)) ))
  271.  
  272. ## @ _DOC_LC_DOCS
  273. ## All documentation files in all other locales
  274. _DOC_LC_DOCS =                                    \
  275.     $(_DOC_LC_MODULES)    $(_DOC_LC_INCLUDES)                \
  276.     $(if $(filter html HTML,$(_DOC_REAL_FORMATS)),$(_DOC_LC_HTML))
  277.  
  278. ## @ _DOC_LC_FIGURES
  279. ## All figures and other external data in all other locales
  280. _DOC_LC_FIGURES = $(foreach lc,$(_DOC_REAL_LINGUAS),                \
  281.     $(patsubst C/%,$(lc)/%,$(_DOC_C_FIGURES)) )
  282.  
  283. _DOC_SRC_FIGURES =                                \
  284.     $(foreach fig,$(_DOC_C_FIGURES), $(foreach lc,C $(_DOC_REAL_LINGUAS),    \
  285.         $(wildcard $(srcdir)/$(lc)/$(patsubst C/%,%,$(fig))) ))
  286.  
  287. $(_DOC_POFILES):
  288.     @if ! test -d $(dir $@); then \
  289.       echo "mkdir $(dir $@)"; \
  290.       mkdir "$(dir $@)"; \
  291.     fi
  292.     @if test ! -f $@ -a -f $(srcdir)/$@; then \
  293.       echo "cp $(srcdir)/$@ $@"; \
  294.       cp "$(srcdir)/$@" "$@"; \
  295.     fi;
  296.     @docs=; \
  297.     list='$(_DOC_C_DOCS_NOENT)'; for doc in $$list; do \
  298.       docs="$$docs $(_DOC_ABS_SRCDIR)/$$doc"; \
  299.     done; \
  300.     if ! test -f $@; then \
  301.       echo "(cd $(dir $@) && \
  302.         $(_xml2po) -e $$docs > $(notdir $@).tmp && \
  303.         cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)"; \
  304.       (cd $(dir $@) && \
  305.         $(_xml2po) -e $$docs > $(notdir $@).tmp && \
  306.         cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp); \
  307.     else \
  308.       echo "(cd $(dir $@) && \
  309.         $(_xml2po) -e -u $(notdir $@) $$docs)"; \
  310.       (cd $(dir $@) && \
  311.         $(_xml2po) -e -u $(notdir $@) $$docs); \
  312.     fi
  313.  
  314. # FIXME: fix the dependancy
  315. # FIXME: hook xml2po up
  316. $(_DOC_LC_DOCS) : $(_DOC_POFILES)
  317. $(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
  318.     if ! test -d $(dir $@); then mkdir $(dir $@); fi
  319.     if [ -f "C/$(notdir $@)" ]; then d="../"; else d="$(_DOC_ABS_SRCDIR)/"; fi; \
  320.     (cd $(dir $@) && \
  321.       $(_xml2po) -e -p \
  322.         "$${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po" \
  323.         "$${d}C/$(notdir $@)" > $(notdir $@).tmp && \
  324.         cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)
  325.  
  326. ## @ _DOC_POT
  327. ## A pot file
  328. _DOC_POT = $(if $(DOC_MODULE),$(DOC_MODULE).pot)
  329. .PHONY: pot
  330. pot: $(_DOC_POT)
  331. $(_DOC_POT): $(_DOC_C_DOCS_NOENT)
  332.     $(_xml2po) -e -o $@ $^
  333.  
  334.  
  335. ################################################################################
  336. ## @@ All Documentation
  337.  
  338. ## @ _DOC_HTML_ALL
  339. ## All HTML documentation, only if it's built
  340. _DOC_HTML_ALL = $(if $(filter html HTML,$(_DOC_REAL_FORMATS)), \
  341.     $(_DOC_C_HTML) $(_DOC_LC_HTML))
  342.  
  343. _DOC_HTML_TOPS = $(foreach lc,C $(_DOC_REAL_LINGUAS),$(lc)/$(DOC_MODULE).xhtml)
  344.  
  345. $(_DOC_HTML_TOPS): $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
  346.     xsltproc -o $@ --xinclude --param db.chunk.chunk_top "false()" --stringparam db.chunk.basename "$(DOC_MODULE)" --stringparam db.chunk.extension ".xhtml" $(_db2html) $(patsubst %.xhtml,%.xml,$@)
  347.  
  348.  
  349. ################################################################################
  350.  
  351. all:                            \
  352.     $(_DOC_C_DOCS)        $(_DOC_LC_DOCS)        \
  353.     $(_DOC_OMF_ALL)        $(_DOC_DSK_ALL)        \
  354.     $(_DOC_HTML_ALL)    $(_DOC_POFILES)
  355.  
  356.  
  357. .PHONY: clean-doc-omf clean-doc-dsk clean-doc-lc clean-doc-dir
  358.  
  359. clean-doc-omf: ; rm -f $(_DOC_OMF_DB) $(_DOC_OMF_HTML)
  360. clean-doc-dsk: ; rm -f $(_DOC_DSK_DB) $(_DOC_DSK_HTML)
  361. clean-doc-lc:
  362.     rm -f $(_DOC_LC_DOCS)
  363.     @list='$(_DOC_POFILES)'; for po in $$list; do \
  364.       if ! test "$$po" -ef "$(srcdir)/$$po"; then \
  365.         echo "rm -f $$po"; \
  366.         rm -f "$$po"; \
  367.       fi; \
  368.     done
  369.     @for lc in C $(_DOC_REAL_LINGUAS); do \
  370.       if test -f "$$lc/.xml2po.mo"; then \
  371.         echo "rm -f $$lc/.xml2po.mo"; \
  372.         rm -f "$$lc/.xml2po.mo"; \
  373.       fi; \
  374.     done
  375. clean-doc-dir:
  376.     @for lc in C $(_DOC_REAL_LINGUAS); do \
  377.       for dir in `find $$lc -depth -type d`; do \
  378.         if ! test $$dir -ef $(srcdir)/$$dir; then \
  379.           echo "rmdir $$dir"; \
  380.           rmdir "$$dir"; \
  381.        fi; \
  382.       done; \
  383.     done
  384.  
  385. _clean_omf = $(if $(_DOC_OMF_IN),clean-doc-omf)
  386. _clean_dsk = $(if $(_DOC_DSK_IN),clean-doc-dsk)
  387. _clean_lc  = $(if $(_DOC_REAL_LINGUAS),clean-doc-lc)
  388. _clean_dir = $(if $(DOC_MODULE),clean-doc-dir)
  389.  
  390. clean-local:                        \
  391.     $(_clean_omf)        $(_clean_dsk)        \
  392.     $(_clean_lc)        $(_clean_dir)
  393. distclean-local:                    \
  394.     $(_clean_omf)        $(_clean_dsk)        \
  395.     $(_clean_lc)        $(_clean_dir)
  396. mostlyclean-local:                    \
  397.     $(_clean_omf)        $(_clean_dsk)        \
  398.     $(_clean_lc)        $(_clean_dir)
  399. maintainer-clean-local:                    \
  400.     $(_clean_omf)        $(_clean_dsk)        \
  401.     $(_clean_lc)        $(_clean_dir)
  402.  
  403.  
  404. .PHONY: dist-doc-docs dist-doc-figs dist-doc-omf dist-doc-dsk
  405. doc-dist-hook:                     \
  406.     $(if $(DOC_MODULE),dist-doc-docs)    \
  407.     $(if $(_DOC_C_FIGURES),dist-doc-figs)    \
  408.     $(if $(_DOC_OMF_IN),dist-doc-omf)
  409. #    $(if $(_DOC_DSK_IN),dist-doc-dsk)
  410.  
  411. dist-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)
  412.     @for lc in C $(_DOC_REAL_LINGUAS); do \
  413.       echo " $(mkinstalldirs) $(distdir)/$$lc"; \
  414.       $(mkinstalldirs) "$(distdir)/$$lc"; \
  415.     done
  416.     @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS) $(_DOC_POFILES)'; \
  417.     for doc in $$list; do \
  418.       if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
  419.       echo "$(INSTALL_DATA) $$d$$doc $(distdir)/$$doc"; \
  420.       $(INSTALL_DATA) "$$d$$doc" "$(distdir)/$$doc"; \
  421.     done
  422.  
  423. dist-doc-figs: $(_DOC_SRC_FIGURES)
  424.     @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; \
  425.     for fig in $$list; do \
  426.       if test -f "$$fig"; then d=; else d="$(srcdir)/"; fi; \
  427.       if test -f "$$d$$fig"; then \
  428.         figdir=`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
  429.         if ! test -d "$(distdir)/$$figdir"; then \
  430.           echo "$(mkinstalldirs) $(distdir)/$$figdir"; \
  431.           $(mkinstalldirs) "$(distdir)/$$figdir"; \
  432.         fi; \
  433.         echo "$(INSTALL_DATA) $$d$$fig $(distdir)/$$fig"; \
  434.         $(INSTALL_DATA) "$$d$$fig" "$(distdir)/$$fig"; \
  435.       fi; \
  436.     done;
  437.  
  438. dist-doc-omf:
  439.     @if test -f "$(_DOC_OMF_IN)"; then d=; else d="$(srcdir)/"; fi; \
  440.     echo "$(INSTALL_DATA) $$d$(_DOC_OMF_IN) $(distdir)/$(notdir $(_DOC_OMF_IN))"; \
  441.     $(INSTALL_DATA) "$$d$(_DOC_OMF_IN)" "$(distdir)/$(notdir $(_DOC_OMF_IN))"
  442.  
  443. dist-doc-dsk:
  444.     @if test -f "$(_DOC_DSK_IN)"; then d=; else d="$(srcdir)/"; fi; \
  445.     echo "$(INSTALL_DATA) $$d$(_DOC_DSK_IN) $(distdir)/$(notdir $(_DOC_DSK_IN))"; \
  446.     $(INSTALL_DATA) "$$d$(_DOC_DSK_IN)" "$(distdir)/$(notdir $(_DOC_DSK_IN))"
  447.  
  448.  
  449. .PHONY: check-doc-docs check-doc-omf
  450. check:                            \
  451.     $(if $(DOC_MODULE),check-doc-docs)        \
  452.     $(if $(_DOC_OMF_IN),check-doc-omf)
  453.  
  454. check-doc-docs: $(_DOC_C_DOCS) $(_DOC_LC_DOCS)
  455.     @for lc in C $(_DOC_REAL_LINGUAS); do \
  456.       if test -f "$$lc"; \
  457.         then d=; \
  458.         xmlpath="$$lc"; \
  459.       else \
  460.         d="$(srcdir)/"; \
  461.         xmlpath="$$lc:$(srcdir)/$$lc"; \
  462.       fi; \
  463.       echo "xmllint --noout --noent --path $$xmlpath --xinclude --postvalid $$d$$lc/$(DOC_MODULE).xml"; \
  464.       xmllint --noout --noent --path "$$xmlpath" --xinclude --postvalid "$$d$$lc/$(DOC_MODULE).xml"; \
  465.     done
  466.  
  467. check-doc-omf: $(_DOC_OMF_ALL)
  468.     @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
  469.       echo "xmllint --noout --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf"; \
  470.       xmllint --noout --dtdvalid 'http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd' $$omf; \
  471.     done
  472.  
  473.  
  474. .PHONY: install-doc-docs install-doc-html install-doc-figs install-doc-omf install-doc-dsk
  475. install-data-local:                    \
  476.     $(if $(DOC_MODULE),install-doc-docs)        \
  477.     $(if $(_DOC_HTML_ALL),install-doc-html)        \
  478.     $(if $(_DOC_C_FIGURES),install-doc-figs)    \
  479.     $(if $(_DOC_OMF_IN),install-doc-omf)
  480. #    $(if $(_DOC_DSK_IN),install-doc-dsk)
  481.  
  482. install-doc-docs:
  483.     @for lc in C $(_DOC_REAL_LINGUAS); do \
  484.       echo "$(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc"; \
  485.       $(mkinstalldirs) $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$lc; \
  486.     done
  487.     @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
  488.       if test -f "$$doc"; then d=; else d="$(srcdir)/"; fi; \
  489.       echo "$(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
  490.       $(INSTALL_DATA) $$d$$doc $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc; \
  491.     done
  492.  
  493. install-doc-figs:
  494.     @list='$(patsubst C/%,%,$(_DOC_C_FIGURES))'; for fig in $$list; do \
  495.       for lc in C $(_DOC_REAL_LINGUAS); do \
  496.         if test -f "$$lc/$$fig"; then \
  497.           figfile="$$lc/$$fig"; \
  498.         elif test -f "$(srcdir)/$$lc/$$fig"; then \
  499.           figfile="$(srcdir)/$$lc/$$fig"; \
  500.         elif test -f "C/$$fig"; then \
  501.           figfile="C/$$fig"; \
  502.         else \
  503.           figfile="$(srcdir)/C/$$fig"; \
  504.         fi; \
  505.         figdir="$$lc/"`echo $$fig | sed -e 's/^\(.*\/\).*/\1/' -e '/\//!s/.*//'`; \
  506.         figdir="$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$figdir"; \
  507.         if ! test -d "$$figdir"; then \
  508.           echo "$(mkinstalldirs) $$figdir"; \
  509.           $(mkinstalldirs) "$$figdir"; \
  510.         fi; \
  511.         figbase=`echo $$fig | sed -e 's/^.*\///'`; \
  512.         echo "$(INSTALL_DATA) $$figfile $$figdir$$figbase"; \
  513.         $(INSTALL_DATA) "$$figfile" "$$figdir$$figbase"; \
  514.       done; \
  515.     done
  516.  
  517. install-doc-html:
  518.     echo install-html
  519.  
  520. install-doc-omf:
  521.     $(mkinstalldirs) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)
  522.     @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
  523.       echo "$(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
  524.       $(INSTALL_DATA) $$omf $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf; \
  525.     done
  526.     @if test "x$(_ENABLE_SK)" = "xtrue"; then \
  527.       echo "scrollkeeper-update -p $(DESTDIR)$(_sklocalstatedir) -o $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
  528.       scrollkeeper-update -p "$(DESTDIR)$(_sklocalstatedir)" -o "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)"; \
  529.     fi;
  530.  
  531. install-doc-dsk:
  532.     echo install-dsk
  533.  
  534.  
  535. .PHONY: uninstall-doc-docs uninstall-doc-html uninstall-doc-figs uninstall-doc-omf uninstall-doc-dsk
  536. uninstall-local:                    \
  537.     $(if $(DOC_MODULE),uninstall-doc-docs)        \
  538.     $(if $(_DOC_HTML_ALL),uninstall-doc-html)    \
  539.     $(if $(_DOC_C_FIGURES),uninstall-doc-figs)    \
  540.     $(if $(_DOC_OMF_IN),uninstall-doc-omf)
  541. #    $(if $(_DOC_DSK_IN),uninstall-doc-dsk)
  542.  
  543. uninstall-doc-docs:
  544.     @list='$(_DOC_C_DOCS) $(_DOC_LC_DOCS)'; for doc in $$list; do \
  545.       echo " rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
  546.       rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$doc"; \
  547.     done
  548.  
  549. uninstall-doc-figs:
  550.     @list='$(_DOC_C_FIGURES) $(_DOC_LC_FIGURES)'; for fig in $$list; do \
  551.       echo "rm -f $(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
  552.       rm -f "$(DESTDIR)$(HELP_DIR)/$(DOC_MODULE)/$$fig"; \
  553.     done;
  554.  
  555. uninstall-doc-omf:
  556.     @list='$(_DOC_OMF_ALL)'; for omf in $$list; do \
  557.       if test "x$(_ENABLE_SK)" == "xtrue"; then \
  558.         echo "scrollkeeper-uninstall -p $(_sklocalstatedir) $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
  559.         scrollkeeper-uninstall -p "$(_sklocalstatedir)" "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
  560.       fi; \
  561.       echo "rm -f $(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
  562.       rm -f "$(DESTDIR)$(OMF_DIR)/$(DOC_MODULE)/$$omf"; \
  563.     done
  564.